package com.shijie.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;


@Data
@NoArgsConstructor
@AllArgsConstructor
public class SjResult<T> implements Serializable {

    private Integer code;

    private String msg;

    private T data;

    public static <T> SjResult<T> success() {
        return new SjResult<>(1, null, null);
    }

    public static <T> SjResult<T> success(T data) {
        return new SjResult<>(1, null, data);
    }

    public static <T> SjResult<T> error(String msg) {
        return new SjResult<>(0, msg, null);
    }

}
